﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SIPO.master" 
AutoEventWireup="true" CodeFile="rptExpenselist.aspx.cs" 
Inherits="SIPO.Web.Reports.Transaction.rptIncome" %>

<asp:Content ID="Content1" ContentPlaceHolderID="body" Runat="Server">
    <link href="<%= ResolveUrl("~/styles/jquery.validate.error.css") %>" rel="stylesheet" type="text/css" />
    <link type="text/css" rel="stylesheet" href="<%= ResolveUrl("~/styles/ui.jqgrid.css") %>" />

    <script src="<%= ResolveUrl("~/scripts/jquery-ui.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/helper.js") %>" type="text/javascript"></script>
  
   
   <h2>Laporan Penggunaan Dana</h2>
<table>
   
  
    <tr>
        <td style="width: 50">Periode</td>
        <td>:</td>
        <td><input type="text" id="txtPeriodeAwal" /> -
        <input type="text" id="txtPeriodeAkhir" />
        </td>
    </tr>
    <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <div style="text-align: right; padding-top: 10px;">
                    <button class="dialog_link ui-state-default ui-corner-all" id="btnNext" type="button">Cetak</button>
                    <button class="dialog_link ui-state-default ui-corner-all" id="btnCancel" type="button">Batal</button>
                </div>
            </td>
        </tr>
        <td>
        </td>
        </table>
<div>
        <asp:ScriptManager ID="scManager" runat="server" EnablePartialRendering="true">
        </asp:ScriptManager>
        <rsweb:reportviewer  ID="rsViewer" runat="server" Height="100%" Width="100%" 
            SizeToReportContent="True">
        </rsweb:reportviewer>
    </div>

    <script type="text/javascript">
        $(document).ready(function () {
            var Awal = '<%= Request.Params["PeriodeAwal"] %>';
            var Akhir = '<%= Request.Params["PeriodeAkhir"] %>';

            $('#txtPeriodeAwal').val(Awal);
            $('#txtPeriodeAkhir').val(Akhir);
            var date = new Date();
            var currentMonth = date.getMonth();
            var currentDate = date.getDate();
            var currentYear = date.getFullYear();
            if (Awal == '' || Awal.toString().toLowerCase().indexOf('2') < 0) {
                $('#txtPeriodeAwal').val('01/01/'+currentYear);
                $('#txtPeriodeAkhir').val(currentDate+'/'+ parseInt((currentMonth)+1)+'/'+currentYear);
            }
            $('#txtPeriodeAwal').focus(function () {
                $('#txtPeriodeAwal').val('');
                if ($('#txtPeriodeAkhir').val() == '') {
                    $('#txtPeriodeAkhir').val('Periode Akhir');
                }
            });
            $('#txtPeriodeAkhir').focus(function () {
                $('#txtPeriodeAkhir').val('');
                if ($('#txtPeriodeAwal').val() == '') {
                    $('#txtPeriodeAwal').val('Periode Awal');
                }
            });

          

            $("#myClass2").hide();
            $('#cbDetail').change(function () {
                if ($(this).is(':checked')) {
                    $("#myClass1").hide();
                    $("#myClass2").show();
                } else {
                    $("#myClass2").hide();
                    $("#myClass1").show();
                }
            });

            $("#txtPeriodeAwal").datepicker({ showWeek: true, showButtonPanel: true,
                changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy',
                numberOfMonths: 1,
//                onClose: function () {
//                    $('#txtPeriodeAkhir').focus();
//                },

                onSelect: function (selected) {
                    $("#txtPeriodeAkhir").datepicker("option", "minDate", selected)
                }
            });

            $("#txtPeriodeAkhir").datepicker({ showWeek: true, showButtonPanel: true,
                changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy',
                numberOfMonths: 1,
                onSelect: function (selected) {
                    $("#txtPeriodeAwal").datepicker("option", "maxDate", selected)
                }
            });

            $('#btnCancel').click(function () {
                $('#txtPeriodeAwal').val('Periode Awal');
                $('#txtPeriodeAkhir').val('Periode Akhir');
            });

            $('#btnNext').click(function () {

                var periodeAwal = $('#txtPeriodeAwal').val();
                var periodeAkhir = $('#txtPeriodeAkhir').val();

                if (periodeAwal != "Periode Awal" && periodeAkhir != "Periode Akhir") {

                    window.location = "rptExpenseList.aspx?PeriodeAwal=" + periodeAwal + "&PeriodeAkhir=" + periodeAkhir;
                }
                else {
                    window.location = "rptExpenseList.aspx?PeriodeAwal=&PeriodeAkhir=";
                }
            });
        });
    </script>
</asp:Content>

